package net.bitacademy.java22.domain;

public class ProfileVO {
	private String id;
	private String tag;	
	private int hwSetting;
	private int soundChecker=0x07;
	private int muteChecker=0x08;
	private int vibrationChecker=0x10;
	private int wifiChecker = 0x20;
	private int bluetoothChecker = 0x40;
	private int hwflagChecker = 0x8000;
	
	private int swSetting;
	private int equipment1Checker = 0x01;
	private int equipment2Checker = 0x02;
	private int equipment3Checker = 0x04;
	private int function1Checker = 0x10;
	private int function2Checker = 0x20;
	private int function3Checker = 0x40;
	private int function4Checker = 0x80;
	private int swflagChecker = 0x8000;
	
	
	
	// hwflag

	public boolean isHwflag() {
		if ((this.hwSetting & hwflagChecker) == hwflagChecker) {
			return true;
		} else {
			return false;
		}
	}

	public String getHwflag() {
		
		if ((this.hwSetting & hwflagChecker) == hwflagChecker) {
			return "On";
		} else {
			return "Off";
		}
	}
	
	public void setHwflag(String flag) {
		hwSetting = hwSetting & (0xffffffff - hwflagChecker);
		if (flag.equals("On"))
			hwSetting = hwSetting | hwflagChecker;
	}
	
	//swflag
	
	public boolean isSwflag() {
		if((this.swSetting & swflagChecker) == swflagChecker){
			return true;
		}else{
			return false;
		}
	}
	
	public String getSwflag() {
		if((this.swSetting & swflagChecker) == swflagChecker){
			return "On";
		}else{
			return "Off";
		}
	}
	
	public void setSwflag(String flag){
		swSetting = swSetting & (0xffffffff - swflagChecker);
		if(flag.equals("On"))
			swSetting = swSetting |	swflagChecker;
	}
	
	
	
	
	
	
	
	
	public int getSwSetting() {
		return swSetting;
	}
	public void setSwSetting(int swSetting) {
		this.swSetting = swSetting;
	}
	
	
	
	public void setHwflag(int hwflag) {
		this.hwflagChecker = hwflagChecker;
	}
	public void setSwflag(int swflag) {
		this.swflagChecker = swflagChecker;
	}
	public void setEquipment1Checker(int equipment1Checker) {
		this.equipment1Checker = equipment1Checker;
	}
	public void setEquipment2Checker(int equipment2Checker) {
		this.equipment2Checker = equipment2Checker;
	}
	public void setEquipment3Checker(int equipment3Checker) {
		this.equipment3Checker = equipment3Checker;
	}
	public void setFunction1Checker(int function1Checker) {
		this.function1Checker = function1Checker;
	}
	public void setFunction2Checker(int function2Checker) {
		this.function2Checker = function2Checker;
	}
	public void setFunction3Checker(int function3Checker) {
		this.function3Checker = function3Checker;
	}
	public void setFunction4Checker(int function4Checker) {
		this.function4Checker = function4Checker;
	}
	
	//equipment1
	public boolean isEquipment1() {
		if((this.swSetting & equipment1Checker) == equipment1Checker){
			return true;
		}else{
			return false;
		}
	}
	public String getEquipment1() {
		if((this.swSetting & equipment1Checker) == equipment1Checker){
			return "On";
		}else{
			return "Off";
		}
	}
	
	public void setEquipment1(String equipment){
		swSetting = swSetting & (0xffffffff - equipment1Checker);
		if(equipment.equals("On"))
			swSetting = swSetting |	equipment1Checker;
	}
	
	//equipment2
	public boolean isEquipment2() {
		if ((this.swSetting & equipment2Checker) == equipment2Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getEquipment2() {
		if ((this.swSetting & equipment2Checker) == equipment2Checker) {
			return "On";
		} else {
			return "Off";
		}
	}

	public void setEquipment2(String equipment) {
		swSetting = swSetting & (0xffffffff - equipment2Checker);
		if (equipment.equals("On"))
			swSetting = swSetting | equipment2Checker;
	}
		
	// equipment3
	public boolean isEquipment3() {
		if ((this.swSetting & equipment3Checker) == equipment3Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getEquipment3() {
		if ((this.swSetting & equipment3Checker) == equipment3Checker) {
			return "On";
		} else {
			return "Off";
		}
	}

	public void setEquipment3(String equipment) {
		swSetting = swSetting & (0xffffffff - equipment3Checker);
		if (equipment.equals("On"))
			swSetting = swSetting | equipment3Checker;
	}
	
	
	// function1
	public boolean isFunction1() {
		if ((this.swSetting & function1Checker) == function1Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getFunction1() {
		if ((this.swSetting & function1Checker) == function1Checker) {
			return "dance";
		} else {
			return "cleaning";
		}
	}

	public void setFunction1(String function) {
		swSetting = swSetting & (0xffffffff - function1Checker);
		if (function.equals("dance"))
			swSetting = swSetting | function1Checker;
	}

	// function2
	public boolean isFunction2() {
		if ((this.swSetting & function2Checker) == function2Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getFunction2() {
		if ((this.swSetting & function2Checker) == function2Checker) {
			return "On";
		} else {
			return "Off";
		}
	}

	public void setFunction2(String function) {
		swSetting = swSetting & (0xffffffff - function2Checker);
		if (function.equals("On"))
			swSetting = swSetting | function2Checker;
	}
	
	// function3
	public boolean isFunction3() {
		if ((this.swSetting & function3Checker) == function3Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getFunction3() {
		if ((this.swSetting & function3Checker) == function3Checker) {
			return "On";
		} else {
			return "Off";
		}
	}

	public void setFunction3(String function) {
		swSetting = swSetting & (0xffffffff - function3Checker);
		if (function.equals("On"))
			swSetting = swSetting | function3Checker;
	}
	
	// function4
	public boolean isFunction4() {
		if ((this.swSetting & function4Checker) == function4Checker) {
			return true;
		} else {
			return false;
		}
	}

	public String getFunction4() {
		if ((this.swSetting & function4Checker) == function4Checker) {
			return "On";
		} else {
			return "Off";
		}
	}

	public void setFunction4(String function) {
		swSetting = swSetting & (0xffffffff - function4Checker);
		if (function.equals("On"))
			swSetting = swSetting | function4Checker;
	}
	
	
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	//tag
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}
	//hardware setting
	public int getHwSetting() {
		return hwSetting;
	}
	public void setHwSetting(int hwSetting) {
		this.hwSetting = hwSetting;
	}
	//sound
	public void setSoundChecker(int soundChecker) {
		this.soundChecker = soundChecker;
	}
	public void setMuteChecker(int muteChecker) {
		this.muteChecker = muteChecker;
	}
	public void setVibrationChecker(int vibrationChecker) {
		this.vibrationChecker = vibrationChecker;
	}
	public void setWifiChecker(int wifiChecker) {
		this.wifiChecker = wifiChecker;
	}
	public void setBluetoothChecker(int bluetoothChecker) {
		this.bluetoothChecker = bluetoothChecker;
	}
	
	
	
	
	public int getSound(){
		return this.hwSetting & soundChecker ;
	}
	
	public void setSound(int sound){
		hwSetting = hwSetting & (0xffffffff - soundChecker);
		if((sound >= 0) || (sound < 8))
			hwSetting = hwSetting |	sound;
	}
	//vibration ++
	public boolean isVibration() {
		if((this.hwSetting & vibrationChecker) == vibrationChecker){
			return true;
		}else{
			return false;
		}
	}
	public String getVibration() {
		if((this.hwSetting & vibrationChecker) == vibrationChecker){
			return "On";
		}else{
			return "Off";
		}
	}	
	public void setVibration(String vibration){
		hwSetting = hwSetting & (0xffffffff - vibrationChecker);
		if(vibration.equals("On"))
			hwSetting = hwSetting |	vibrationChecker;
	}
	
	//wifi
	public boolean isWifi() {
		if((this.hwSetting & wifiChecker) == wifiChecker){
			return true;
		}else{
			return false;
		}
	}
	public void setWifi(String wifi){
		hwSetting = hwSetting & (0xffffffff - wifiChecker);
		if(wifi.equals("On"))
			hwSetting = hwSetting |	wifiChecker;
	}
	
	public void setWifi2(boolean wifi){
		hwSetting = hwSetting & (0xffffffff - wifiChecker);
		if(wifi)
			hwSetting = hwSetting |	wifiChecker;
	}
	
	public String getWifi() {
		if((this.hwSetting & wifiChecker) == wifiChecker){
			return "On";
		}else{
			return "Off";
		}
	}		
	
	//bluetooth
	public boolean isBluetooth() {
		if((this.hwSetting & bluetoothChecker) == bluetoothChecker){
			return true;
		}else{
			return false;
		}
	}
	public void setBluetooth(String bluetooth){
		hwSetting = hwSetting & (0xffffffff - bluetoothChecker);
		if(bluetooth.equals("On"))
			hwSetting = hwSetting |	bluetoothChecker;
	}
	public void setBluetooth2(boolean bluetooth){
		hwSetting = hwSetting & (0xffffffff - bluetoothChecker);
		if(bluetooth)
			hwSetting = hwSetting |	bluetoothChecker;
	}
	public String getBluetooth() {
		if((this.hwSetting & bluetoothChecker) == bluetoothChecker){
			return "On";
		}else{
			return "Off";
		}
	}
	
}